<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:70:"F:\liudian\fly_forum\public/../application/index\view\Card\detail.html";i:1520415665;s:53:"F:\liudian\fly_forum\application\index\view\base.html";i:1520410612;}*/ ?>


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $title; ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="fly,layui,前端社区">
    <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" href="/fly_forum/public/static/layui/css/layui.css">
    <link rel="stylesheet" href="/fly_forum/public/static/home/css/global.css">
</head>
<body>

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="<?php echo url('Index/index'); ?>">
            <img src="/fly_forum/public/static/home/images/logo.png" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="<?php echo url('Index/index'); ?>"><i class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item">
                <a href="#" onclick="WeAdminShow('在线直播','https://staticlive.douyucdn.cn/common/share/play.swf?room_id=85894')"><i class="iconfont icon-iconmingxinganli"></i>在线直播</a>
            </li>
            <li class="layui-nav-item">
                <a href="#" onclick="WeAdminShow('在线电影','http://www.cmmov.net/')"><i class="iconfont icon-ui"></i>在线影视</a>
            </li>
        </ul>

        <ul class="layui-nav fly-nav-user">

            
            <?php if(empty(\think\Session::get('home'))): ?>
                <!-- 未登入的状态 -->
                <li class="layui-nav-item">
                    <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/login'); ?>"></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/login'); ?>">登入</a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/reg'); ?>">注册</a>
                </li>
            <?php else: ?>
                <!-- 登入后的状态 -->
                <li class="layui-nav-item">
                    <?php if(empty(\think\Session::get('home.image'))): ?>
                        <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/set'); ?>"></a>
                    <?php else: ?>
                        <a  href="<?php echo url('User/set'); ?>"><img style="height: 40px;width: 40px;border-radius: 20px" src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',session('home.image'),0); ?>"></a>
                    <?php endif; ?>

                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/set'); ?>"><?php echo \think\Session::get('home.name'); ?></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/loginOut'); ?>">退出</a>
                </li>
            <?php endif; if(empty(\think\Session::get('home'))): ?>
            <li class="layui-nav-item layui-hide-xs">
                <a href="<?php echo url('User/qqlogin'); ?>" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" title="QQ登入" class="iconfont icon-qq"></a>
            </li>
            <!-- <li class="layui-nav-item layui-hide-xs">
                <a href="/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" title="微博登入" class="iconfont icon-weibo"></a> -->
            </li>
            <?php else: endif; ?>

            
        </ul>
    </div>
</div>



<script src="/fly_forum/public/static/home/js/jquery-1.7.2.js"></script>
<script src="/fly_forum/public/static/layui/layui.js"></script>

<!--<div class="layui-hide-xs">-->
<!--<div class="fly-panel fly-column">-->
<!--<div class="layui-container">-->
<!--<ul class="layui-clear">-->
<!--<li class="layui-hide-xs"><a href="/">首页</a></li>-->
<!--<li class="layui-this"><a href="">提问</a></li>-->
<!--<li><a href="">分享<span class="layui-badge-dot"></span></a></li>-->
<!--<li><a href="">讨论</a></li>-->
<!--<li><a href="">建议</a></li>-->
<!--<li><a href="">公告</a></li>-->
<!--<li><a href="">动态</a></li>-->
<!--<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>-->

<!--&lt;!&ndash; 用户登入后显示 &ndash;&gt;-->
<!--<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="../user/index.html">我发表的贴</a></li>-->
<!--<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="../user/index.html#collection">我收藏的贴</a></li>-->
<!--</ul>-->

<!--<div class="fly-column-right layui-hide-xs">-->
<!--<span class="fly-search"><i class="layui-icon"></i></span>-->
<!--<a href="add.html" class="layui-btn">发表新帖</a>-->
<!--</div>-->
<!--<div class="layui-hide-sm layui-show-xs-block" style="margin-top: -10px; padding-bottom: 10px; text-align: center;">-->
<!--<a href="add.html" class="layui-btn">发表新帖</a>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->

<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md8 content detail">
            <div class="fly-panel detail-box">
                <h1><?php echo $cardInfo['name']; ?></h1>
                <div class="fly-detail-info">
                    <!-- <span class="layui-badge">审核中</span> -->
                    <span class="layui-badge layui-bg-green fly-detail-column"><?php echo $cardInfo['category_name']; ?></span>

                    <?php switch($cardInfo['is_end']): case "1": ?><span class="layui-badge" style="background-color: #999;">未结</span><?php break; case "2": ?><span class="layui-badge" style="background-color: #5FB878;">已结</span><?php break; endswitch; if($cardInfo['is_first'] == '1'): ?>
                    <span class="layui-badge layui-bg-black">置顶</span>
                    <?php endif; if($cardInfo['is_fine'] == '1'): ?>
                    <span class="layui-badge layui-bg-red">精帖</span>
                    <?php endif; ?>


                <span class="fly-list-nums">
                    <a href="#comment"><i class="iconfont" title="回答">&#xe60c;</i> <?php echo $cardInfo['evaluate_num']; ?></a>
                    <i class="iconfont" title="人气">&#xe60b;</i> <?php echo $cardInfo['browse']; ?>
                    <i class="layui-icon" id="coll" title="收藏" onclick="collect(this)">&#xe600;</i>
                    <input type="hidden" value="<?php echo $cardInfo['id']; ?>">
                    <span id="collect"><?php echo $cardInfo['collect_num']; ?></span>

                </span>
                </div>
                <div class="detail-about">
                    <a class="fly-avatar" href="<?php echo url('User/home',['id'=>$cardInfo['user_id']]); ?>">
                        <?php if(empty($cardInfo['image'])): ?>
                        <img src="/fly_forum/public/static/head.jpg" alt="<?php echo $cardInfo['username']; ?>">
                        <?php else: ?>
                        <img src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',$cardInfo['image'],0); ?>" alt="<?php echo $cardInfo['username']; ?>">
                        <?php endif; ?>
                    </a>
                    <div class="fly-detail-user">
                        <a href="<?php echo url('User/home',['id'=>$cardInfo['user_id']]); ?>" class="fly-link">
                            <cite><?php echo $cardInfo['username']; ?></cite>
                            <?php if($cardInfo['level'] > '0'): ?>
                            <i class="iconfont icon-renzheng" title="认证信息：{{ rows.user.approve }}"></i>
                            <?php endif; ?>

                            <i class="layui-badge fly-badge-vip">
                                <?php switch($cardInfo['level']): case "0": ?>普通用户<?php break; case "1": ?>VIP1<?php break; case "2": ?>VIP2<?php break; case "3": ?>VIP3<?php break; case "4": ?>VIP4<?php break; case "5": ?>VIP5<?php break; endswitch; ?>
                            </i>
                        </a>
                        <!--<span><?php echo $cardInfo['create_time']; ?></span>-->
                    </div>
                    <div class="detail-hits" id="LAY_jieAdmin" data-id="123">
                        <?php if($cardInfo['sort'] == '1'): ?>
                        <span style="padding-right: 10px; color: #FF7200">悬赏：<?php echo $cardInfo['gold']; ?>金币</span>
                        <?php endif; ?>

                        <!--<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="add.html">  </a></span>-->
                        <span class="time"><?php echo $cardInfo['create_time']; ?></span>
                    </div>
                </div>
                <div class="detail-body photos">
                    <?php echo $cardInfo['content']; ?>
                </div>
            </div>

            <div class="fly-panel detail-box" id="flyReply">
                <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
                    <legend>回帖</legend>
                </fieldset>

                <ul class="jieda" id="jieda">
                    <?php if(!empty($evalList)): if(is_array($evalList) || $evalList instanceof \think\Collection || $evalList instanceof \think\Paginator): if( count($evalList)==0 ) : echo "" ;else: foreach($evalList as $key=>$val): ?>
                    <li data-id="111">
                        <a name="item-1111111111"></a>
                        <div class="detail-about detail-about-reply" id="take_<?php echo $val['id']; ?>">
                            <a class="fly-avatar" href="<?php echo url('User/home',['id'=>$val['user_id']]); ?>">
                                <?php if(empty($val['image'])): ?>
                                <img src="/fly_forum/public/static/head.jpg" alt="<?php echo $val['username']; ?>">
                                <?php else: ?>
                                <img src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',$val['image'],0); ?>" alt="<?php echo $val['username']; ?>">
                                <?php endif; ?>
                            </a>
                            <div class="fly-detail-user">
                                <a href="<?php echo url('User/home',['id'=>$val['user_id']]); ?>" class="fly-link">
                                    <cite><?php echo $val['username']; ?></cite>&nbsp;
                                    <?php if($val['level'] > '0'): ?>
                                    <i class="iconfont icon-renzheng" title="认证信息：{{ rows.user.approve }}"></i>
                                    <?php endif; ?>

                                    <i class="layui-badge fly-badge-vip">
                                        <?php switch($val['level']): case "0": ?>普通用户<?php break; case "1": ?>VIP1<?php break; case "2": ?>VIP2<?php break; case "3": ?>VIP3<?php break; case "4": ?>VIP4<?php break; case "5": ?>VIP5<?php break; endswitch; ?>
                                    </i>
                                </a>
                                <?php if($val['user_id'] == $cardInfo['id']): ?>
                                <span>(楼主)</span>
                                <?php endif; ?>
                            </div>
                            <div class="detail-hits">
                                <span class="time"><?php echo $val['create_time']; ?></span>
                            </div>
                            <?php if(!empty($val['take'])): ?>
                            <i class="iconfont icon-caina" title="最佳答案"></i>
                            <?php endif; ?>
                            <!--<i class="iconfont icon-caina" title="最佳答案"></i>-->
                        </div>
                        <div class="detail-body jieda-body photos">
                            <?php echo $val['eval_content']; ?>
                        </div>
                        <div class="jieda-reply">
                            <span class="jieda-zan" type="zan" id="zan" onclick="changeZan(this)">
                                <i class="iconfont icon-zan"></i>
                                <em id="zan_num"><?php echo $val['zan']; ?></em>
                            </span>
                            <!--帖子id-->
                            <input type="hidden" name="card_id" value="<?php echo $cardInfo['id']; ?>">
                            <!--评论id-->
                            <input type="hidden" name="id" value="<?php echo $val['id']; ?>">
                            <span type="reply" onclick="reply(this)">
                                <a href="#comment">
                                    <i class="iconfont icon-svgmoban53"></i>
                                    回复
                                </a>
                            </span>
                            <input type="hidden" name="username" value="<?php echo $val['username']; ?>">
                            <input type="hidden" name="url" value="<?php echo url('User/home',['id'=>$val['user_id']]); ?>">
                            <?php if($cardInfo['sort'] == '1'): if(empty($cardInfo['good_user_id'])): ?>
                            <div class="jieda-admin">
                                <span class="jieda-accept card_take" type="accept" onclick="take(this)">采纳</span>
                                <!--帖子主人的id-->
                                <input type="hidden" value="<?php echo $cardInfo['user_id']; ?>">
                                <!--帖子的id-->
                                <input type="hidden" value="<?php echo $cardInfo['id']; ?>">
                                <!--这条评论的id-->
                                <input type="hidden" value="<?php echo $val['id']; ?>">
                                <!--发这条评论人的id-->
                                <input type="hidden" value="<?php echo $val['user_id']; ?>">
                            </div>
                            <?php endif; endif; ?>
                        </div>
                    </li>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                    <!--分页显示-->
                    <?php echo $evalPage; else: ?>
                    <li class="fly-none">消灭零回复</li>
                    <?php endif; ?>
                </ul>

                <div class="layui-form layui-form-pane">
                    <form action="<?php echo url('Card/reply'); ?>" method="post">
                        <div class="layui-form-item layui-form-text">
                            <a name="comment"></a>
                            <!-- 加载编辑器的容器 -->
                            <div class="layui-input-block" style="z-index: 998">
                                <script id="container" name="content1" type="text/plain" style="height: 200px;" ></script>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <input type="hidden" name="card_id" value="<?php echo $cardInfo['id']; ?>">
                            <button class="layui-btn"  lay-submit>提交回复</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="layui-col-md4">
            <dl class="fly-panel fly-list-one">
                <dt class="fly-panel-title">本周热议</dt>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>
                <dd>
                    <a href="">基于 layui 的极简社区页面模版</a>
                    <span><i class="iconfont icon-pinglun1"></i> 16</span>
                </dd>

                <!-- 无数据时 -->
                <!--
                <div class="fly-none">没有相关数据</div>
                -->
            </dl>

            <div class="fly-panel">
                <div class="fly-panel-title">
                    这里可作为广告区域
                </div>
                <div class="fly-panel-main">
                    <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">LayIM 3.0 - layui 旗舰之作</a>
                </div>
            </div>

            <div class="fly-panel" style="padding: 20px 0; text-align: center;">
                <img src="../../res/images/weixin.jpg" style="max-width: 100%;" alt="layui">
                <p style="position: relative; color: #666;">微信扫码关注 layui 公众号</p>
            </div>

        </div>
    </div>
</div>

<div class="fly-footer">
    <p><a href="http://fly.layui.com/" target="_blank">Fly社区</a> 2017 &copy; <a href="http://www.layui.com/" target="_blank">layui.com 出品</a></p>
    <p>
        <a href="http://fly.layui.com/jie/3147/" target="_blank">付费计划</a>
        <a href="http://www.layui.com/template/fly/" target="_blank">获取Fly社区模版</a>
        <a href="http://fly.layui.com/jie/2461/" target="_blank">微信公众号</a>
    </p>
</div>

<!-- 配置文件 -->
<script type="text/javascript" src="/fly_forum/public/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/fly_forum/public/static/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>

<script>
    $(function(){
        //已进入页面就执行,判断该贴是否已经被收藏
        var CardId = $("#coll").next().val();
        $.ajax({
            type : "get",
            url : "<?php echo url('Collect/showCollect'); ?>",
            data : {card_id:CardId},
            success : function(msg){
                if(msg == 1){
                    $("#coll").replaceWith('<i class="layui-icon" title="收藏" onclick="collect(this)">&#xe658;</i>');
                }else if(msg == 0){
                    $("#coll").replaceWith('<i class="layui-icon" title="收藏" onclick="collect(this)">&#xe600;</i>');
                }
            }
        })
    })

    $(".time").each(function(){
        var time = $(this).text();
        time = time.substring(0,10);
        $(this).text(time);
    })
    //点赞
    function changeZan(obj){
//        console.log($(obj).next().val());
        var card_id = $(obj).next().val();//帖子id
        var eval_id = $(obj).next().next().val();//评论id
//        var zan_num = $(obj).children("em").text();
//        console.log(zan_num);
        $.ajax({
            type : "get",
            url : "<?php echo url('Evaluate/zan'); ?>",
            data : {id:card_id,evalId:eval_id},
            success : function(data){
                var zan_num = $(obj).children("em").text();
                console.log(data);
                if(data == 0){
                    alert("请先登录");
                    document.location.href="<?php echo url('User/login'); ?>";
                }else if(data == 1){
                    zan_num = parseInt(zan_num) + 1;
                    $(obj).children("em").text(zan_num)
                    $(obj).addClass("zanok");
                }else if(data == 2){
                    zan_num = parseInt(zan_num) - 1;
                    $(obj).children("em").text(zan_num)
                    $(obj).removeClass("zanok");
                }

            }
        })
    }
    //回帖
    function reply(obj){
        var name = $(obj).next().val();
        var url = $(obj).next().next().val();
        console.log(url);
        name = "<a href='"+url+"'>@"+name+"</a>";

        ue.setContent(name);
    }
    //采纳
    function take(obj){
        <!--帖子主人的id-->
        var userId = $(obj).next().val();
        <!--帖子的id-->
        var cardId = $(obj).next().next().val();
        <!--这条评论的id-->
        var evalId = $(obj).next().next().next().val();
        <!--发这条评论人的id-->
        var evalUserId = $(obj).next().next().next().next().val();
        $.ajax({
            type : "get",
            url : "<?php echo url('Evaluate/take'); ?>",
            data : {id:userId,card_id:cardId,eval_id:evalId,eval_user_id:evalUserId},
            success : function(msg){
                if(msg == 0){
                    layer.open({
                        title: '错误提示'
                        ,content: '您还没有登录,或者您不是本帖子的贴主'
                    });
                }else if(msg == 1){
                    layer.open({
                        title: '错误提示'
                        ,content: '采纳失败'
                    });
                }else if(msg == 2){
                    $("#take_"+evalId).append('<i class="iconfont icon-caina" title="最佳答案"></i>');
                    $(".card_take").empty();
                }
            }
        })
    }
    //收藏
    function collect(obj){
        var cardId = $(obj).next().val();
        var collect_num = parseInt($("#collect").text());
        $.ajax({
            type : "get",
            url : "<?php echo url('Collect/collect'); ?>",
            data : {card_id:cardId},
            success : function(msg){
                if(msg == 0){
                    layer.open({
                        title: '错误提示'
                        ,content: '您还没有登录,不能收藏此贴'
                    });
                }else if(msg == 1){
                    $("#collect").text(collect_num+1);
                    $(obj).replaceWith('<i class="layui-icon" title="收藏" onclick="collect(this)">&#xe658;</i>');
                }else if(msg == 2){
                    $("#collect").text(collect_num-1);
                    $(obj).replaceWith('<i class="layui-icon" title="收藏" onclick="collect(this)">&#xe600;</i>');
                }else if(msg == 3){
                    layer.open({
                        title: '错误提示'
                        ,content: '收藏失败'
                    });
                }
            }
        })
    }
</script>

<script>
    layui.cache.page = '';
    layui.cache.user = {
        username: '游客'
        ,uid: -1
        ,avatar: '/fly_forum/public/static/home/images/avatar/00.jpg'
        ,experience: 83
        ,sex: '男'
    };
    layui.config({
        version: "3.0.0"
        ,base: '/fly_forum/public/static/home/mods/' //这里实际使用时，建议改成绝对路径
    }).extend({
        fly: 'index'
    }).use('fly');



    /*
     * @todo 弹出层，弹窗方法
     * layui.use 加载layui.define 定义的模块，当外部 js 或 onclick调用 use 内部函数时，需要在 use 中定义 window 函数供外部引用
     * http://blog.csdn.net/xcmonline/article/details/75647144 
     */
    /*
        参数解释：
        title   标题
        url     请求的url
        id      需要操作的数据id
        w       弹出层宽度（缺省调默认值）
        h       弹出层高度（缺省调默认值）
    */
    window.WeAdminShow = function(title, url, w, h) {
        if(title == null || title == '') {
            title = false;
        };
        if(url == null || url == '') {
            url = "404.html";
        };
        if(w == null || w == '') {
            w = ($(window).width() * 0.9);
        };
        if(h == null || h == '') {
            h = ($(window).height() - 50);
        };
        layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: true,
            shade: 0.4,
            title: title,
            content: url
        });
    }
</script>

<!-- <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script> -->

</body>
</html>